import { WorkerBasicWrapper } from '@/main/core/worker/worker_basic';
import { StartWorker } from '@/main/core/worker/worker_starter';
import { ExportAll,Thread, InjectWorker, HasReturn, ExportProperty } from '@/main/core/worker/worker_desc';


@ExportAll()
class Client{
  inner(){
    console.log(`I'm a function inside a property in the b thread`)
  }
}

@ExportAll()
@Thread()
export class TestBWroker extends WorkerBasicWrapper {
  
  @InjectWorker('worker-1')
  private aoo;
  
  @ExportProperty()
  private client;
  constructor() {
    super();
    this.client = new Client()
  }

  sayHi(name: string) {
    const msg = `hello, i'm ${process.identity}`;
    console.log(`[${process.identity}][sayHi]:`, `hello ${name},`);
    console.log(`[${process.identity}][sayHi]:`, `I will send you a message of [${msg}]`);
    return msg;
  }
}
StartWorker(TestBWroker);
